package com.notifier;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

public class HTTPGetUtility {
	
	public static final String SURLY_TOUR_URL = "http://www.surlybrewing.com/tours/tourregistration.php";
	URL url;
	URLConnection conn;

	
	public HTTPGetUtility() throws IOException{
		url = new URL(SURLY_TOUR_URL);
	}
	
	public String getHTTP(){
		String result = "";
		try{
			URLConnection conn = url.openConnection();
			
			BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
			StringBuffer sb = new StringBuffer();
			String line;
			while((line = rd.readLine()) != null){
				sb.append(line);
			}
			rd.close();
			result = sb.toString();
		}
		catch(Exception e){
			e.printStackTrace();
		}
		return result;
	}

}
